package com.spring.takeaway.controller;

import com.spring.takeaway.po.Food;
import com.spring.takeaway.po.Order;
import com.spring.takeaway.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author LCD
 * @Date 2022/6/12 14:45
 **/
@RestController
public class FoodController {


    @Autowired
    private FoodService foodService;

    @GetMapping("/getFoodList/{Id}")
    public List<Food> getFoodList(@PathVariable int Id){
        return this.foodService.findListFood(Id);
    }

    @PostMapping("/insertOrder")
    public int insertOrder(@RequestBody Order order){

        return this.foodService.insertOrder(order);
    }

    @GetMapping("/getOder/{phone}")
    public List<Order> getOrder(@PathVariable String phone){
        return this.foodService.findListOrder(phone);
    }

}
